﻿namespace RotovapPlatform.Domain.Business.Storage.Entities.Bottles;
using RotovapPlatform.Domain.Business.Storage.Entities.Base;
using RotovapPlatform.Domain.Business.Machine.Enums;
using RotovapPlatform.Domain.Business.Storage.Enums;
using static RotovapPlatform.Domain.Business.Machine.Enums.ExperimentConfigEnums;

public abstract class Bottle : IStorageItem
{
	private ItemType _type;

	public ItemType Type
	{
		get => _type;
		protected set
		{
			// 验证瓶子类型
			var allowedTypes = new[]
			{
				ItemType.Rotovap_500ml,
				ItemType.Rotovap_1000ml,
				ItemType.CentrifugeBottle_500ml,
				ItemType.SampleBottle_8ml
			};

			if (!allowedTypes.Contains(value))
				throw new ArgumentException($"Invalid bottle type: {value}");

			_type = value;
		}
	}

	public FunctionType Function { get; set; }       // 功能分类

	public Guid? ExperimentId { get; set; }       // 实验ID

	public string? ExperimentName { get; set; }       // 实验名称

	public string? ExperimentDescription { get; set; }  //实验描述

	public DateTime? ExperimentStartTime { get; set; }       // 实验开始时间

	public DateTime? ExperimentEndTime { get; set; }       // 实验完成时间

	public string? ExperimentStatus { get; set; }       // 实验状态

	public string? ExperimentType { get; set; }       // 实验类型

	public DateTime? StackInTime { get; set; }       // 入库时间

	public DateTime? StackOutTime { get; set; }      // 出库时间

	public string Operator { get; set; }       // 操作员

	public string? BarCode { get; set; }        // 条形码

	public bool? IsNeedStackOut { get; set; }       // 是否需要出库

	protected Bottle()
	{
		// 默认构造函数，子类需要设置Type属性
	}

	protected Bottle(ItemType type)
	{
		Type = type;
	}
}